#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    bool checkXMatrix(vector<vector<int>> &grid)
    {
        int size = grid.size();
        for (int i = 0; i < size; i++)
        {
            for (int j = 0; j < size; j++)
            {
                if ((i == j) || (i + j == size - 1))
                {
                    if (grid[i][j] == 0)
                    {
                        return false;
                    }
                }
                else
                {
                    if (grid[i][j])
                    {
                        return false;
                    }
                }
            }
        }
        return true;
    }
};